export const SPLIT_HX = "-";
export const SPLIT_XHX = "_";
export const SPLIT_COMMA = ",";
export const SPLIT_NO = "#";
export const SPLIT_PERCENT = "%";
export const SPLIT_COLON = ":";
export const SPLIT_ZKH = "(";
export const SPLIT_YKH = ")";
export const SPLIT_XG = "/";
export const SPLIT_BLANK = "";
export const SPLIT_SPACE = " ";
export const SPLIT_DOT = ".";
export const ENTRY_LINE = "\r\n";


//投料状态枚举
export function commonFlagEnum(key) {
    let dic = {
        0: "否",
        1: "是",
        2: "出错",
        3: "待确认",
    }
    return dic[key] ? dic[key] : "未知"
}

//投料状态枚举
export function planStatusEnum(key) {
    let dic = {
        0: "有问题",
        1: "准备中",
        2: "执行中",
        3: "已完成",
        5: "用纱确认",
    }
    return dic[key] ? dic[key] : "未知"
}

//投料状态枚举
export function feedTypeEnum(key, value) {
    let dic = {
        1: "原料",
        2: "细纱",
        3: "粗纱",
        4: "色毛",
    }
    if(key) {
        return dic[key] ? dic[key] : "未知"
    } else if(value) {
        return Object.keys(dic).find(k => dic[k] == value);
    }
}

//操作车间
export function feedWorkshopStoreEnum(key, value) {
    let dic = {
        "散染车间": "散染临仓",
        "纺纱车间": "纺纱临仓",
    }
    if(key) {
        return dic[key] ? dic[key] : "未知"
    } else if(value) {
        return Object.keys(dic).find(k => dic[k] == value);
    }
}

//单双面枚举
export function doubleFlagEnum(key) {
    let dic = {
        "1": "单面",
        "2": "双面",
    }
    return dic[key] ? dic[key] : "未知"
}

//提花枚举
export function jacquardFlagEnum(key) {
    let dic = {
        "0": "一般",
        "1": "提花",
    }
    return dic[key] ? dic[key] : "未知"
}

//混色枚举
export function colorNumEnum(key) {
    let dic = {
        "1": "素色",
        "2": "混色",
        "3": "格子",
        "4": "条纹",
    }
    return dic[key] ? dic[key] : "未知"
}
//提花枚举
export function wayFlagEnum(key) {
    let dic = {
        "1": "针织",
        "2": "梭织",
    }
    return dic[key] ? dic[key] : "未知"
}

//备件类型枚举
export const SPARE_PART_TYPE_ENUM = {
    1: "塑胶",
    2: "金属",
    3: "电机",
    4: "电器",
}
export function sparePartTypeEnumFn(key, value) {
    if(key) {
        return SPARE_PART_TYPE_ENUM[key] ? SPARE_PART_TYPE_ENUM[key] : "未知"
    } else if(value) {
        return Object.keys(SPARE_PART_TYPE_ENUM).find(k => SPARE_PART_TYPE_ENUM[k] == value);
    }
}

//备件类型枚举
export const SPARE_PART_ROOM_ENUM = {
    1: "通用",
    2: "纺纱",
    3: "织造",
    4: "后整",
}
export function sparePartRoomEnumFn(key, value) {
    if(key) {
        return SPARE_PART_ROOM_ENUM[key] ? SPARE_PART_ROOM_ENUM[key] : "未知"
    } else if(value) {
        return Object.keys(SPARE_PART_ROOM_ENUM).find(k => SPARE_PART_ROOM_ENUM[k] == value);
    }
}

//单位
export const UNIT_ENUM = {
    1: "个",
    2: "件",
    3: "盒",
    4: "包",
    5: "箱",
    6: "卷",
    7: "条",
    8: "袋",
    9: "捆",
    10: "张",
    11: "捅",
    12: "瓶"
}
export function unitEnumFn(key, value) {
    if(key) {
        return UNIT_ENUM[key] ? UNIT_ENUM[key] : "未知"
    } else if(value) {
        return Object.keys(UNIT_ENUM).find(k => UNIT_ENUM[k] == value);
    }
}

//备件回收标记
export const SPARE_PART_RECYCLING_ENUM = {
    1: "消耗品",
    2: "安装件",
    3: "回旧件",
}
export function sparePartRecyclingEnumFn(key, value) {
    if(key) {
        return SPARE_PART_RECYCLING_ENUM[key] ? SPARE_PART_RECYCLING_ENUM[key] : "未知"
    } else if(value) {
        return Object.keys(SPARE_PART_RECYCLING_ENUM).find(k => SPARE_PART_RECYCLING_ENUM[k] == value);
    }
}

//备件状态
export const SPARE_PART_STATUS_ENUM = {
    1: "待审批",
    2: "待采购",
    3: "已入库",
    4: "已出库",
    5: "驳回",
    6: "待入库",
    7: "待分类",
    8: "待废弃",
    9: "待维修",
    10: "已废弃",
    11: "修理中",
    12: "已修理",
}
export function sparePartStatusEnumFn(key, value) {
    if(key) {
        return SPARE_PART_STATUS_ENUM[key] ? SPARE_PART_STATUS_ENUM[key] : "未知"
    } else if(value) {
        return Object.keys(SPARE_PART_STATUS_ENUM).find(k => SPARE_PART_STATUS_ENUM[k] == value);
    }
}

//能耗计量类型(车间/位置)
export const ENERGY_METER_TYPE = {
    1: "散染车间",
    2: "纺纱车间",
    3: "织布车间",
    4: "染整车间",
    5: "宿舍楼",
    6: "办公楼"
}
export function energyMeterTypeEnumFn(key, value) {
    if(key) {
        return ENERGY_METER_TYPE[key] ? ENERGY_METER_TYPE[key] : "未知";
    } else if(value) {
        return Object.keys(ENERGY_METER_TYPE).find(k => ENERGY_METER_TYPE[k] == value);
    } else {
        return "出错"
    }
}

//巡查状态
export const INSPECT_STATUS = {
    1: "待巡查",
    2: "待更换(维修)",
    3: "正常",
}
export function inspectStatusEnumFn(key, value) {
    if(key) {
        return INSPECT_STATUS[key] ? INSPECT_STATUS[key] : "未知";
    } else if(value) {
        return Object.keys(INSPECT_STATUS).find(k => INSPECT_STATUS[k] == value);
    } else {
        return "出错"
    }
}

//维保状态
export const MAINTENANCE_STATUS = {
    1: "待维修",
    2: "待换配件",
    3: "保养完毕"
}

//设备类型
export const EQUIPMENT_TYPE = {
    1: "主要设备",
    2: "辅助设备",
}